package com.suxin.socket.yinfei.session;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import javax.websocket.Session;
import java.util.Collection;
import java.util.concurrent.CopyOnWriteArraySet;

/**
 * @author Tang
 * @classname SimpleSessionConnectionHolder
 * @description [ 无参 ]
 * @date 2021/8/17 22:34
 */
@Slf4j
public class SimpleSessionConnectionHolder extends AbstractSessionConnectionHolder {

    @Getter
    private CopyOnWriteArraySet sessions = new CopyOnWriteArraySet();

    @Override
    public void onOpen(Session session) {
        super.onOpen(session);
        sessions.add(session);
    }

    @Override
    public Collection<Session> getSession() {
        return sessions;
    }

}